Display
MetadataViews.Display
Display MetadataView returns the following:
- name: String - The name of the object.
- description - A written description of the object.
- thumbnail: AnyStruct - Small thumbnail representation of the object.
- url - This field should be a web-friendly file (i.e JPEG, PNG) that can be displayed in lists, link previews, etc.
import Golazos from 0xGOLAZOSADDRESS
import MetadataViews from 0xMETADATAVIEWSADDRESS
pub fun main(address: Address, id: UInt64): MetadataViews.Display {
let account = getAccount(address)
let collectionRef = account.getCapability(Golazos.CollectionPublicPath)
.borrow<&{Golazos.MomentNFTCollectionPublic}>()
?? panic("Could not borrow capability from public collection")
let nft = collectionRef.borrowMomentNFT(id: id)
?? panic("Couldn't borrow momentNFT")
return nft.resolveView(Type<MetadataViews.Display>())! as! MetadataViews.Display
}